package com.liu.lab10.controller;

import com.liu.lab10.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

@Controller("userController")
//@Component("userController")
public class UserController {
    @Autowired
    @Qualifier("userServiceImpl")
    private UserService userService;

    public UserController(UserService userService) {
        this.userService = userService;
    }

    public UserService getUserService() {
        return userService;
    }

    public void setUserService(UserService userService) {
        this.userService = userService;
    }

//    调用 userService 的login方法
    public boolean login(String name,String password) {
        return userService.login(name, password);
    }
    //    调用 userService 的info方法
    public void info(int id,String name) {
        userService.info(id,name);
    }
}

